package com.bootdo.member.dao;

import com.bootdo.member.domain.ShequMember;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 用户表
 * @author lujingqian
 * @email 2100272728@qq.com
 * @date 2019-11-08 14:04:00
 */
@Mapper
public interface ShequMemberDao {

	ShequMember get(Long id);
	
	List<ShequMember> list(Map<String,Object> map);
	
	int count(Map<String,Object> map);
	
	int save(ShequMember shequMember);
	
	int update(ShequMember shequMember);
	
	int remove(Long id);
	
	int batchRemove(Long[] ids);

	@Select("select * from me_shequ_member where mobile=#{mobile}")
    ShequMember getByMobile(@Param("mobile") String mobile);

	@Select("select * from me_shequ_member where mobile=#{mobile} and password=#{password}")
	ShequMember selectMobileAndPassWord(@Param("mobile")String mobile, @Param("password") String password);

	@Update("update me_shequ_member set integral=integral+#{integral} where mobile=#{mobile}")
	int updateIntegerAdd(@Param("integral") Double integral,@Param("mobile")String mobile);

	@Update("update me_shequ_member set integral=integral-#{integral} where mobile=#{mobile} and integral>=#{integral}")
	int updateIntegerMinus(@Param("integral")Double integer, @Param("mobile")String mobile);


    List<ShequMember> listDescByMoney(HashMap<String, Object> map);
}
